package com.youlai.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.youlai.system.model.entity.AttendanceDeductionSetting;
import com.youlai.system.mapper.AttendanceDeductionSettingMapper;
import com.youlai.system.service.IAttendanceDeductionSettingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.Data;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 只茂瑞
 * @since 2024-06-24
 */
@Service
@Data
public class AttendanceDeductionSettingServiceImpl extends ServiceImpl<AttendanceDeductionSettingMapper, AttendanceDeductionSetting> implements IAttendanceDeductionSettingService {

    private final AttendanceDeductionSettingMapper attendanceDeductionSettingMapper;

    @Override
    public List<AttendanceDeductionSetting> getDeductionSettingForm(Long id) {
        QueryWrapper<AttendanceDeductionSetting> queryWrapper = new QueryWrapper<AttendanceDeductionSetting>()
                .eq("department_id",id);
        List<AttendanceDeductionSetting> list = this.list(queryWrapper);
        return list;
    }

    @Override
    public Integer updateAttendUpdateDeductionStatus(AttendanceDeductionSetting attendanceDeductionSetting) {
        attendanceDeductionSettingMapper.updateDeduction(attendanceDeductionSetting);
        return attendanceDeductionSetting.getId();
    }
}
